package com.kefu.chat.vo;

import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.kefu.chat.model.ChatFaqGroupDocRel;
import com.kefu.common.vo.AbstractSearchVo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotEmpty;

@Data
public class ChatFaqGroupDocRelSearchVo extends AbstractSearchVo {
    @NotEmpty
    private String groupId;
    @ApiModelProperty(value = "问题类型")
    private Integer questionType;
    @ApiModelProperty(value = "访客端显示名称")
    private String questionName;

    @Override
    public LambdaQueryWrapper<ChatFaqGroupDocRel> lambdaQuery() {
        LambdaQueryWrapper<ChatFaqGroupDocRel> wrapper = Wrappers.lambdaQuery(ChatFaqGroupDocRel.class);
        wrapper.eq(ChatFaqGroupDocRel::getGroupId, groupId);
        wrapper.eq(ObjectUtil.isNotNull(questionType), ChatFaqGroupDocRel::getQuestionType, questionType);
        wrapper.like(StrUtil.isNotBlank(questionName), ChatFaqGroupDocRel::getQuestionName, questionName);
        return wrapper;
    }
}
